<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/taglibs.jsp"%>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="${ctx}/resources/semanticui/semantic.min.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/resources/apps.css" rel="stylesheet" type="text/css" />
<title>订单详情</title>
</head>
<body>
	<div class="ui segment" id="n-page">
		<h4 class="ui horizontal divider header">
		  <i class="tag icon"></i>
			 订单信息
		</h4>
		<table class="ui definition table">
		  <tbody>
		    <tr>
		      <td class="two wide column">订单编号</td>
		      <td><a href="${ctx}/wechat/hunter/toOrderDetail.do?orderId=${order.id}">YQS${order.ordercode}</a></td>
		    </tr>
		    <tr>
		      <td class="two wide column">订单状态</td>
		      <td><span style="color:#F47e2d;font-weight:bold;">${order.statusName}</span>
		      	<c:if test="${order.status==0}">
		      		<button class="ui button active" id="accept" data-position-id="${order.id}" style="float:right;background-color:#1fbad6!important;padding-top:0.7rem;padding-bottom:0.5rem;color:#fff">接单</button>
		      		<button class="ui button active" id="refuse" data-position-id="${order.id}" style="float:right;background-color:#1fbad6!important;padding-top:0.7rem;padding-bottom:0.5rem;color:#fff">拒单</button>
		      	</c:if>
		      </td>
		    </tr>
		    <tr>
		      <td>预约时间</td>
		      <td>${order.orderTime}</td>
		    </tr>
		    <tr>
		      <td>预约服务</td>
		      <td>￥${desc.spec}/${desc.name}</td>
		    </tr>
		    <tr>
		      <td>联系人</td>
		      <td>${(emp.phone).substring(0,7)}****<a href="${ctx}/wechat/hunter/toViewCandidate.do?mobile=${emp.phone}">点击查看基础信息</a></td>
		    </tr>
		  </tbody>
		</table>
		<div class="ui divider"></div>
		<h4 class="ui horizontal divider header">
		  <i class="user circle outline icon"></i>
			 超时补差价
		</h4>
		<div class="ui raised segment">
			<p>计划项目时长：50分钟</p>
			<div class="ui segment" id="n-content">
				<div class="ui form">
				   <div class="field">
				    <label>超出时长</label>
				    <input type="hidden" id="id" name="id" value="${order.id}">
				   	<input type="text" id="priceDiffTime" name="priceDiffTime" value="${order.priceDiffTime}">分钟
				   </div>
				  <div class="filed">
				  	<label>请按照实际超出时间输入，若时间超过计划项目时长，用户将需额外补足余款。</label>
				 </div>
			 	</div>
			</div>
		</div>
		<div class="ui segment" id="choice-buttons">
			<div class="fluid ui button" id="next">确认无误，提交</div>
		</div>
    
	<script src="${ctx}/resources/jweixin-1.0.0.js"></script>
	<script src="${ctx}/resources/semanticui/jquery-2.1.4.min.js"></script>
	<script src="${ctx}/resources/semanticui/semantic.js"
		type="text/javascript"></script>
	<script type="text/javascript">
/* 
wx.config({
    debug: false, 
    appId: "${config.appid}",  
    timestamp: ${config.currenttimestamp},  
    nonceStr: "${config.nonceStr}", 
    signature: "${config.signatureStr}", 
    jsApiList: ['checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'showOptionMenu',
        'closeWindow']  
}); */

        var handler = {
            activate : function() {
                $(this).addClass('active').siblings().removeClass('active');

                if($(this).attr('id') == 'closeit') {
                    wx.closeWindow();
                }

                if ($(this).attr('id') == 'next') {
					var time = $("#priceDiffTime").val();
					var orderId = $("#id").val();
					if (!priceDiffTime || priceDiffTime == "") {
						alert("您需输入实际用时！");
						return false;
					}
					$(this).addClass('disabled');
					var that = this;
					var postUrl = '${ctx}/wechat/order/upPriceDiffdOrder.do';
					var param = {};
					param['orderId'] = orderId;
					param['time'] = time;
					$.ajax({
							url : postUrl,
							type : "POST",
							data : param,
							success : function(data) {
								if (data.errorcode == "0") {
									var hunter = data.data;
									location.href = '${ctx}/wechat/hunter/toOrderDetail.do?orderId='
											+ orderId;
									return;
								} else if (data.errorcode == "1") {
									alert(data.msg);
									return;
								} else {
									alert(data.msg);
									$(that).removeClass('disabled');
								}
							},
							error : function() {
								alert("服务出错，请稍后尝试");
								$(that).removeClass('disabled');
							}
						});
				}
         
            }
        };

        $(document).ready(function() {
          
                $('.button').on('click', handler.activate);
                wx.ready(function() {   
                wx.onMenuShareAppMessage({
                    title: 'Headoffer--专业招聘平台----推荐有奖！',  
                    desc: '搭起企业和专业猎头的桥梁，为企业招募英才。',  
                    link: 'http://www.tiaonali.com${ctx}/wechat/hunter/shareservice.page',  
                    imgUrl: 'http://www.tiaonali.com${ctx}/resources/images/sharelogo.jpg',  
                    type: 'link'
                });

                wx.onMenuShareTimeline({
                    title: 'Headoffer--专业招聘平台----推荐有奖！',  
                    desc: '搭起企业和专业猎头的桥梁，为企业招募英才。',  
                    link: 'http://www.tiaonali.com${ctx}/wechat/hunter/shareservice.page',  
                    imgUrl: 'http://www.tiaonali.com${ctx}/resources/images/sharelogo.jpg'
                });

                wx.showOptionMenu();
            });
        });
    </script>
</body>
</html>